package org.hackystat.sdsa.analyzer.control.compressor;

import org.junit.Test;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;

/**
 * Test the utility class for activity compression.
 * 
 * @author hongbing
 *
 */
public class TestCompressorUtil {
  /**
   * Test the begin and end pair.
   */ 
  @Test public void testBeginEndPair() {
     CompressorUtil.BeginEndPair data = new CompressorUtil.BeginEndPair();
     assertFalse("Check valid of default value", data.isValid());
     assertEquals("Test length 0", 0, data.length());

     data.setBegin(0);
     assertTrue("Check 0 as begin", data.isValid());
     assertEquals("Test length 1", 1, data.length());

     data.setBegin(-1);
     assertFalse("Check -1 as begin", data.isValid());

     data.setBegin(1);
     assertFalse("Check multiplness", data.isMultiple());

     data.setEnd(5);
     assertTrue("Check multiplness", data.isMultiple());

     assertEquals("Test length of activities.", 5, data.length());
  }
}
